home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / CursorDevices.p < prev    next >
Encoding:
Text File  |  1997-08-12  |  7.5 KB  |  207 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        CursorDevices.p
  3.  
  4.      Contains:    Cursor Devices (mouse/trackball/etc) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1993-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT CursorDevices;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __CURSORDEVICES__}
  28. {$SETC __CURSORDEVICES__ := 1}
  29.  
  30. {$I+}
  31. {$SETC CursorDevicesIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __MIXEDMODE__}
  38. {$I MixedMode.p}
  39. {$ENDC}
  40.  
  41.  
  42. {$PUSH}
  43. {$ALIGN MAC68K}
  44. {$LibExport+}
  45.  
  46. {
  47.                         * * *  I M P O R T A N T  * * * 
  48.  
  49.             You will need CursorDevicesGlue.o to use CDM from PowerPC
  50.  
  51.  
  52.     In order to use the Cursor Devices Manager (CDM) on PowerPC systems, you must 
  53.     link with the file CursorDevicesGlue.o and InterfaceLib 1.1.3.  This is necessary
  54.     because the original MixedMode transition code for CDM in InterfaceLib in ROM
  55.     was wrong.  The code in CursorDevicesGlue.o will check to see if the ROM has
  56.     been fixed and calls through to it if so.  If it detects that the ROM has not
  57.     been fixed, it uses its own implementation of the CDM MixedMode transition 
  58.     routines. 
  59.     
  60. }
  61.  
  62.  
  63. TYPE
  64.     ButtonOpcode                        = INTEGER;
  65. { ButtonOpcodes }
  66.  
  67. CONST
  68.     kButtonNoOp                    = 0;                            {  No action for this button  }
  69.     kButtonSingleClick            = 1;                            {  Normal mouse button  }
  70.     kButtonDoubleClick            = 2;                            {  Click-release-click when pressed  }
  71.     kButtonClickLock            = 3;                            {  Click on press, release on next press  }
  72.  
  73.     kButtonCustom                = 6;                            {  Custom behavior, data = CursorDeviceCustomButtonUPP  }
  74.  
  75. { Device Classes }
  76.     kDeviceClassAbsolute        = 0;                            {  a flat-response device  }
  77.     kDeviceClassMouse            = 1;                            {  mechanical or optical mouse  }
  78.     kDeviceClassTrackball        = 2;                            {  trackball  }
  79.     kDeviceClassTrackPad        = 3;
  80.  
  81.     kDeviceClass3D                = 6;                            {  a 3D pointing device  }
  82.  
  83. { Structures used in Cursor Device Manager calls }
  84.  
  85. TYPE
  86.     CursorDataPtr = ^CursorData;
  87.     CursorData = RECORD
  88.         nextCursorData:            CursorDataPtr;                            {  next in global list  }
  89.         displayInfo:            Ptr;                                    {  unused (reserved for future)  }
  90.         whereX:                    Fixed;                                    {  horizontal position  }
  91.         whereY:                    Fixed;                                    {  vertical position  }
  92.         where:                    Point;                                    {  the pixel position  }
  93.         isAbs:                    BOOLEAN;                                {  has been stuffed with absolute coords  }
  94.         buttonCount:            SInt8;                                    {  number of buttons currently pressed  }
  95.         screenRes:                LONGINT;                                {  pixels per inch on the current display  }
  96.         privateFields:            ARRAY [0..21] OF INTEGER;                {  fields use internally by CDM  }
  97.     END;
  98.  
  99.     CursorDevicePtr = ^CursorDevice;
  100.     CursorDevice = RECORD
  101.         nextCursorDevice:        CursorDevicePtr;                        {  pointer to next record in linked list  }
  102.         whichCursor:            CursorDataPtr;                            {  pointer to data for target cursor  }
  103.         refCon:                    LONGINT;                                {  application-defined  }
  104.         unused:                    LONGINT;                                {  reserved for future  }
  105.         devID:                    OSType;                                    {  device identifier (from ADB reg 1)  }
  106.         resolution:                Fixed;                                    {  units/inch (orig. from ADB reg 1)  }
  107.         devClass:                SInt8;                                    {  device class (from ADB reg 1)  }
  108.         cntButtons:                SInt8;                                    {  number of buttons (from ADB reg 1)  }
  109.         filler1:                SInt8;                                    {  reserved for future  }
  110.         buttons:                SInt8;                                    {  state of all buttons  }
  111.         buttonOp:                PACKED ARRAY [0..7] OF UInt8;            {  action performed per button  }
  112.         buttonTicks:            ARRAY [0..7] OF LONGINT;                {  ticks when button last went up (for debounce)  }
  113.         buttonData:                ARRAY [0..7] OF LONGINT;                {  data for the button operation  }
  114.         doubleClickTime:        LONGINT;                                {  device-specific double click speed  }
  115.         acceleration:            Fixed;                                    {  current acceleration  }
  116.         privateFields:            ARRAY [0..14] OF INTEGER;                {  fields used internally to CDM  }
  117.     END;
  118.  
  119. { for use with CursorDeviceButtonOp when opcode = kButtonCustom }
  120.     CursorDeviceCustomButtonProcPtr = Register68kProcPtr;  { PROCEDURE CursorDeviceCustomButton(ourDevice: CursorDevicePtr; button: INTEGER); }
  121.  
  122.     CursorDeviceCustomButtonUPP = UniversalProcPtr;
  123.  
  124. CONST
  125.     uppCursorDeviceCustomButtonProcInfo = $000ED802;
  126.  
  127. FUNCTION NewCursorDeviceCustomButtonProc(userRoutine: CursorDeviceCustomButtonProcPtr): CursorDeviceCustomButtonUPP;
  128.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  129.     INLINE $2E9F;
  130.     {$ENDC}
  131.  
  132. PROCEDURE CallCursorDeviceCustomButtonProc(ourDevice: CursorDevicePtr; button: INTEGER; userRoutine: CursorDeviceCustomButtonUPP);
  133.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  134.     {To be implemented:  Glue to move parameters into registers.}
  135.     {$ENDC}
  136. FUNCTION CursorDeviceMove(ourDevice: CursorDevicePtr; deltaX: LONGINT; deltaY: LONGINT): OSErr;
  137.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  138.     INLINE $7000, $AADB;
  139.     {$ENDC}
  140. FUNCTION CursorDeviceMoveTo(ourDevice: CursorDevicePtr; absX: LONGINT; absY: LONGINT): OSErr;
  141.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  142.     INLINE $7001, $AADB;
  143.     {$ENDC}
  144. FUNCTION CursorDeviceFlush(ourDevice: CursorDevicePtr): OSErr;
  145.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  146.     INLINE $7002, $AADB;
  147.     {$ENDC}
  148. FUNCTION CursorDeviceButtons(ourDevice: CursorDevicePtr; buttons: INTEGER): OSErr;
  149.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  150.     INLINE $7003, $AADB;
  151.     {$ENDC}
  152. FUNCTION CursorDeviceButtonDown(ourDevice: CursorDevicePtr): OSErr;
  153.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  154.     INLINE $7004, $AADB;
  155.     {$ENDC}
  156. FUNCTION CursorDeviceButtonUp(ourDevice: CursorDevicePtr): OSErr;
  157.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  158.     INLINE $7005, $AADB;
  159.     {$ENDC}
  160. FUNCTION CursorDeviceButtonOp(ourDevice: CursorDevicePtr; buttonNumber: INTEGER; opcode: ButtonOpcode; data: LONGINT): OSErr;
  161.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  162.     INLINE $7006, $AADB;
  163.     {$ENDC}
  164. FUNCTION CursorDeviceSetButtons(ourDevice: CursorDevicePtr; numberOfButtons: INTEGER): OSErr;
  165.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  166.     INLINE $7007, $AADB;
  167.     {$ENDC}
  168. FUNCTION CursorDeviceSetAcceleration(ourDevice: CursorDevicePtr; acceleration: Fixed): OSErr;
  169.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  170.     INLINE $7008, $AADB;
  171.     {$ENDC}
  172. FUNCTION CursorDeviceDoubleTime(ourDevice: CursorDevicePtr; durationTicks: LONGINT): OSErr;
  173.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  174.     INLINE $7009, $AADB;
  175.     {$ENDC}
  176. FUNCTION CursorDeviceUnitsPerInch(ourDevice: CursorDevicePtr; resolution: Fixed): OSErr;
  177.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  178.     INLINE $700A, $AADB;
  179.     {$ENDC}
  180. FUNCTION CursorDeviceNextDevice(VAR ourDevice: CursorDevicePtr): OSErr;
  181.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  182.     INLINE $700B, $AADB;
  183.     {$ENDC}
  184. FUNCTION CursorDeviceNewDevice(VAR ourDevice: CursorDevicePtr): OSErr;
  185.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  186.     INLINE $700C, $AADB;
  187.     {$ENDC}
  188. FUNCTION CursorDeviceDisposeDevice(ourDevice: CursorDevicePtr): OSErr;
  189.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  190.     INLINE $700D, $AADB;
  191.     {$ENDC}
  192.  
  193.  
  194.  
  195.  
  196.  
  197. {$ALIGN RESET}
  198. {$POP}
  199.  
  200. {$SETC UsingIncludes := CursorDevicesIncludes}
  201.  
  202. {$ENDC} {__CURSORDEVICES__}
  203.  
  204. {$IFC NOT UsingIncludes}
  205.  END.
  206. {$ENDC}
  207.